package com.changgou.goods.dao;

import com.changgou.goods.pojo.Spu;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface SpuMapper extends Mapper<Spu> {
    //查询回收站商品
    @Select("select * from tb_spu where is_delete ='1'")
    @Results({@Result(column = "brand_id", property = "brandId"),
            @Result(column = "category1_id", property = "category1Id"),
            @Result(column = "category2_id", property = "category2Id"),
            @Result(column = "category3_id", property = "category3Id"),
            @Result(column = "template_id", property = "templateId"),
            @Result(column = "freight_id", property = "freightId"),
            @Result(column = "sale_service", property = "saleService"),
            @Result(column = "spec_items", property = "specItems"),
            @Result(column = "sale_num", property = "saleNum"),
            @Result(column = "comment_num", property = "commentNum"),
            @Result(column = "is_marketable", property = "isMarketable"),
            @Result(column = "is_enable_spec", property = "isEnableSpec"),
            @Result(column = "is_delete", property = "isDelete")})
    List<Spu> findReGoods();


    //条件查询
    @Select("select * from tb_spu where id = #{queryString} or name like '%#{queryString}%'")
    List<Spu> query(String queryString);
}

